namespace ScrumSprintMonitor.UI.Wpf
{
	#region #using Directives

	using System;
	using System.Runtime.InteropServices;

	#endregion

	public static class NativeMethods
	{
		#region EXECUTION_STATE enum

		[Flags]
		public enum EXECUTION_STATE : uint
		{
			ES_SYSTEM_REQUIRED = 0x00000001,
			ES_DISPLAY_REQUIRED = 0x00000002,
			// Legacy flag, should not be used.
			// ES_USER_PRESENT   = 0x00000004,
			ES_CONTINUOUS = 0x80000000,
		}

		#endregion

		[DllImport("Powrprof.dll", SetLastError = true)]
		public static extern bool SetSuspendState(bool hibernate, bool forceCritical, bool disableWakeEvent);

		[DllImport("powrprof.dll")]
		public static extern bool IsPwrSuspendAllowed();

		[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
		public static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags);
	}
}